﻿﻿<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>ProClinic-医院管理系统Bootstrap4前端框架</title>
	<!-- Fav  Icon Link -->
	<link rel="shortcut icon" type="image/png" href="images/fav.png">
	<!-- Bootstrap core CSS -->
	<link rel="stylesheet" href="css/bootstrap.min.css">
	<!-- themify icons CSS -->
	<link rel="stylesheet" href="css/themify-icons.css">
	<!-- Animations CSS -->
	<link rel="stylesheet" href="css/animate.css">
	<!-- Main CSS -->
	<link rel="stylesheet" href="css/styles.css">
	<link rel="stylesheet" href="css/green.css" id="style_theme">
	<link rel="stylesheet" href="css/responsive.css">
	<!-- morris charts -->
	<link rel="stylesheet" href="charts/css/morris.css">
	<!-- jvectormap -->
	<link rel="stylesheet" href="css/jquery-jvectormap.css">
	<link rel="stylesheet" href="datatable/dataTables.bootstrap4.min.css">

	<script src="js/modernizr.min.js"></script>
</head>

<body>
<!-- Pre Loader -->
<div class="loading">
	<div class="spinner">
		<div class="double-bounce1"></div>
		<div class="double-bounce2"></div>
	</div>
</div>
<!--/Pre Loader -->
<!-- Color Changer -->
<div class="theme-settings" id="switcher">
		<span class="theme-click">
			<span class="ti-settings"></span>
		</span>
	<span class="theme-color theme-default theme-active" data-color="green"></span>
	<span class="theme-color theme-blue" data-color="blue"></span>
	<span class="theme-color theme-red" data-color="red"></span>
	<span class="theme-color theme-violet" data-color="violet"></span>
	<span class="theme-color theme-yellow" data-color="yellow"></span>
</div>
<!-- /Color Changer -->
<div class="wrapper">
	<!-- Page Content -->
	<div id="content">
		<!-- Top Navigation -->
		<div class="container top-brand">
			<nav class="navbar navbar-default">
				<div class="navbar-header">
					<div class="sidebar-header"> <a href="index.html"><img src="images/logo-dark.png" class="logo" alt="logo"></a>
					</div>
				</div>
				<ul class="nav justify-content-end">
					<li class="nav-item">
						<a class="nav-link">
							<span title="Fullscreen" class="ti-fullscreen fullscreen"></span>
						</a>
					</li>
					<li class="nav-item">
						<a class="nav-link" data-toggle="modal" data-target=".lochana-modal-lg">
							<span class="ti-search"></span>
						</a>
						<div class="modal fade lochana-modal-lg" tabindex="-1" role="dialog" aria-hidden="true">
							<div class="modal-dialog modal-lorvens">
								<div class="modal-content lochana-box-shadow2">
									<div class="modal-header">
										<h5 class="modal-title">Search Patient/医生:</h5>
										<span class="ti-close" data-dismiss="modal" aria-label="Close">
												</span>
									</div>
									<div class="modal-body">
										<form>
											<div class="form-group">
												<input type="text" class="form-control" id="search-term" placeholder="Type text here">
												<button type="button" class="btn btn-lorvens lochana-bg">
													<span class="ti-location-arrow"></span> Search</button>
											</div>
										</form>
									</div>
								</div>
							</div>
						</div>
					</li>
					<li class="nav-item">
						<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
						   aria-expanded="false">
							<span class="ti-announcement"></span>
						</a>
						<div class="dropdown-menu lochana-box-shadow2 notifications animated flipInY">
							<h5>Notifications</h5>
							<a class="dropdown-item" href="#">
								<span class="ti-wheelchair"></span> New Patient Added</a>
							<a class="dropdown-item" href="#">
								<span class="ti-money"></span> Patient payment done</a>
							<a class="dropdown-item" href="#">
								<span class="ti-time"></span>Patient Appointment booked</a>
							<a class="dropdown-item" href="#">
								<span class="ti-wheelchair"></span> New Patient Added</a>
						</div>
					</li>
					<li class="nav-item">
						<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
						   aria-expanded="false">
							<span class="ti-user"></span>
						</a>
						<div class="dropdown-menu lochana-box-shadow2 profile animated flipInY">
							<h5>John Willing</h5>
							<a class="dropdown-item" href="#">
								<span class="ti-settings"></span> Settings</a>
							<a class="dropdown-item" href="#">
								<span class="ti-help-alt"></span> Help</a>
							<a class="dropdown-item" href="#">
								<span class="ti-power-off"></span> Logout</a>
						</div>
					</li>
				</ul>

			</nav>
		</div>
		<!-- /Top Navigation -->
		<!-- Menu -->
		<div class="container menu-nav">
			<nav class="navbar navbar-expand-lg lochana-bg text-white">
				<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
						aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
					<span class="ti-menu text-white"></span>
				</button>

				<div class="collapse navbar-collapse" id="navbarSupportedContent">
					<ul class="navbar-nav mr-auto">
						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-home"></span> 控制面板</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="index.html">默认</a>
							</div>
						</li>
						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-wheelchair"></span> 病人管理</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="add-patient.html">添加病人信息</a>
								<a class="dropdown-item" href="patients.html">查看病人信息</a>
								<a class="dropdown-item" href="about-patient.html">病人详情</a>
								<a class="dropdown-item" href="edit-patient.html">编辑病人信息</a>
							</div>
						</li>
						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-user"></span> 医生管理</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="add-doctor.html">添加医生信息</a>
								<a class="dropdown-item" href="doctors.html">查询医生信息</a>
								<a class="dropdown-item" href="about-doctor.html">医生信息详情</a>
								<a class="dropdown-item" href="edit-doctor.html">编辑医生信息</a>
							</div>
						</li>
						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-pencil-alt"></span> 出诊管理</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="add-appointment.html">添加出诊信息</a>
								<a class="dropdown-item" href="appointments.html">查询出诊信息</a>
								<a class="dropdown-item" href="about-appointment.html">出诊信息详情</a>
								<a class="dropdown-item" href="edit-appointment.html">编辑出诊信息</a>
							</div>
						</li>
						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-money"></span> 支付管理</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="add-payment.html">添加支付</a>
								<a class="dropdown-item" href="payments.html">所有支付</a>
								<a class="dropdown-item" href="about-payment.html">发票</a>
							</div>
						</li>
						<li class="nav-item dropdown active">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-key"></span> 病房分配</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="add-room.html">添加病房</a>
								<a class="dropdown-item" href="rooms.html">查询病房</a>
								<a class="dropdown-item" href="edit-room.html">编辑病房信息</a>
							</div>
						</li>

						<li class="nav-item dropdown">
							<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true"
							   aria-expanded="false"><span class="ti-file"></span> 其它页面</a>
							<div class="dropdown-menu">
								<a class="dropdown-item" href="login.html">登录</a>
								<a class="dropdown-item" href="sign-up.html">注册</a>
								<a class="dropdown-item" href="404.html">404</a>
								<a class="dropdown-item" href="blank-page.html">空白页</a>
								<a class="dropdown-item" href="pricing.html">价格表</a>
								<a class="dropdown-item" href="faq.html">FAQ</a>
								<a class="dropdown-item" href="invoice.html">发票</a>
							</div>
						</li>
					</ul>
				</div>
			</nav>
		</div>
		<!-- /Menu -->
		<!-- Breadcrumb -->
		<!-- Page Title -->
		<div class="container mt-0">
			<div class="row breadcrumb-bar">
				<div class="col-md-6">
					<h3 class="block-title">Edit Room Allotment</h3>
				</div>
				<div class="col-md-6">
					<ol class="breadcrumb">
						<li class="breadcrumb-item">
							<a href="index.html">
								<span class="ti-home"></span>
							</a>
						</li>
						<li class="breadcrumb-item">Room Allotments</li>
						<li class="breadcrumb-item active">Edit Room Allotment</li>
					</ol>
				</div>
			</div>
		</div>
		<!-- /Page Title -->

		<!-- /Breadcrumb -->
		<!-- Main Content -->
		<div class="container">

			<div class="row">
				<!-- Widget Item -->
				<div class="col-md-12">
					<div class="widget-area-2 lochana-box-shadow">
						<h3 class="widget-title">Edit Room Allotment</h3>
						<form>
							<div class="form-row">
								<div class="form-group col-md-6">
									<label for="roomNumber">房间号</label>
									<input value="10" type="text" class="form-control" placeholder="Room Number" id="roomNumber" name="roomNumber">
								</div>

								<div class="form-group col-md-6">
									<label for="patientName">病人姓名</label>
									<input value="Damodar Reddy" type="text" placeholder="名人姓名" class="form-control" id="patientName" name="patientName">
								</div>
								<div class="form-group col-md-6">
									<label for="inTime">住院时间</label>
									<input value="2018-10-10" disabled="disabled" type="date" placeholder="Allotment Date" class="form-control" id="inTime" name="inTime">
								</div>
								<div class="form-group col-md-6">
									<label for="outTime">出院时间</label>
									<input value="2018-10-16" type="date" placeholder="Discharge Date" class="form-control" id="outTime" name="outTime">
								</div>
								<div class="form-group col-md-6">
									<label for="doctorName">医生姓名</label>
									<input value="Dr Manoj Kumar" type="text" placeholder="医生" class="form-control" id="doctorName" name="doctorName">
								</div>

								<div class="form-group col-md-6 mb-3">
									<button type="button" class="btn btn-primary btn-lg" id="update">修改</button>
								</div>
							</div>
						</form>
						<!-- Alerts-->

						<!-- /Alerts-->
					</div>
				</div>
				<!-- /Widget Item -->
			</div>
		</div>
		<!-- /Main Content -->
		<!--Copy Rights-->
		<div class="container">
			<div class="d-sm-flex justify-content-center">
				<span class="text-muted text-center d-block d-sm-inline-block">Copyright © 2020. All rights reserved.</span>
			</div>
		</div>
		<!-- /Copy Rights-->
	</div>
	<!-- /Page Content -->
</div>
<!-- Back to Top -->
<a id="back-to-top" href="#" class="back-to-top">
	<span class="ti-angle-up"></span>
</a>
<!-- /Back to Top -->
<!-- Jquery Library-->
<script src="js/jquery-3.2.1.min.js"></script>
<!-- Popper Library-->
<script src="js/popper.min.js"></script>
<!-- Bootstrap Library-->
<script src="js/bootstrap.min.js"></script>

<!-- Datatable  -->
<script src="datatable/jquery.dataTables.min.js"></script>
<script src="datatable/dataTables.bootstrap4.min.js"></script>

<!-- Custom Script-->
<script src="js/custom.js"></script>
<script>
	//获取URL上的参数
	(function ($) {
		$.getUrlParam = function (name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
			var r = window.location.search.substr(1).match(reg);
			if (r != null) return unescape(r[2]); return null;
		}
	})(jQuery);

	let id= $.getUrlParam('inhospitalId');
	//对
	$.getJSON("/inhospital/1",
			{inhospitalId:id},
			function (result,status,xhr) {
				if(result.data!=null){
					$("#roomNumber").val(result.data.room.roomName);
					$("#patientName").val(result.data.patient.patientName);
					$("#doctorName").val(result.data.doctor.doctorName);
					$("#inTime").val(result.data.inTime);
					$("#outTime").val(result.data.outTime);
				}
			});


	$("#update").click(function () {
		let roomName = $("#roomNumber").val();
		let patientName = $("#patientName").val();
		let doctorName = $("#doctorName").val();
		let inTime = $("#inTime").val();
		let outTime = $("#outTime").val();
		$.ajax({
			type: "POST",
			data: {
				inhospitalId: id,
				roomName:roomName,
				doctorName: doctorName,
				patientName: patientName,
				inTime: inTime,
				outTime: outTime
			},
			url: "/inhospital/update",
			dataType: "json"
		}).done((result) => {
			if (result.data) {
				alert("修改成功");
				location.href = "./rooms.html";
			}
		}).fail(() => {
			alert("修改失败");
		});

	});


</script>
</body>

</html>